package com.qj.travel.tools;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;

import java.io.IOException;

/**
 * Created by Admin on 2016/10/13.
 */
public class HttpGet {
    HttpClient client = new HttpClient();

    private static HttpMethod getMethod(String url) throws IOException{
        GetMethod method = new GetMethod(url);
        return method;
    }

    public String requestGet(String url) throws IOException {
        HttpMethod method = getMethod(url);
        client.executeMethod(method);
        String response = method.getResponseBodyAsString();
        return response;
    }
}
